﻿#region

using System;
using System.Windows;
using Radovici.SharedLibrary;

#endregion

namespace Radovici.Ctrls.Desktop
{
    public class WidgetModel : Notifiable
    {
        #region Private fields        

        private readonly Func<UIElement> _loadView;
        private readonly MenuItemModel _menuItem;

        #endregion

        public WidgetModel(Func<UIElement> loadView)
        {
            _loadView = loadView;
        }

        public WidgetModel(MenuItemModel menuItem) //Func<UIElement> loadView)
        {
            _menuItem = menuItem;
        }

        public MenuItemModel Model
        {
            get { return _menuItem; }
        }

        public UIElement LoadView()
        {
            if (_loadView != null)
            {
                return _loadView();
            }
            return _menuItem.LoadView();
        }
    }
}